package com.webdev.newtech.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.webdev.newtech.domain.TlService;
import com.webdev.newtech.mapper.ITlServiceMapper;
import com.webdev.newtech.service.ITlServiceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ITlServiceServiceImpl implements ITlServiceService {

    @Resource
    ITlServiceMapper serviceMapper;


    @Override
    public int add(TlService service) {
        return serviceMapper.insert(service);
    }

    @Override
    public int remove(Integer id) {
        return serviceMapper.deleteById(id);
    }

    @Override
    public int update(TlService service) {
        return serviceMapper.updateById(service);
    }

    @Override
    public List<TlService> getList(TlService service) {
        QueryWrapper<TlService> wrapper=new QueryWrapper<>();
        wrapper.eq(service.getStatus()!=null,"status",service.getStatus() );
        wrapper.orderByAsc("order_num");
        return serviceMapper.selectList(wrapper);
    }

    @Override
    public TlService getById(Integer id) {
        return serviceMapper.selectById(id);
    }
}

